Skip to content

Conversation

@vonosmas
Copy link
Contributor

Addressing the comments from PR #130368 review. Since Bazel builds are effectively overlay mode, switch to explicitly setting -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_SYSTEM configuration option, so that unit tests and release builds are consistent. Verified that all the unit tests pass with this flag specified.

Addressing the comments from PR llvm#130368 review. Since Bazel builds
are effectively overlay mode, switch to explicitly setting
-DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_SYSTEM configuration option, so that
unit tests and release builds are consistent. Verified that all the
unit tests pass with this flag specified.
@vonosmas vonosmas requested a review from lntue March 10, 2025 20:14
@llvmbot llvmbot added libc bazel "Peripheral" support tier build system: utils/bazel labels Mar 10, 2025
@vonosmas vonosmas added bazel "Peripheral" support tier build system: utils/bazel and removed bazel "Peripheral" support tier build system: utils/bazel labels Mar 10, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 10, 2025

@llvm/pr-subscribers-libc

Author: Alexey Samsonov (vonosmas)

Changes

Addressing the comments from PR #130368 review. Since Bazel builds are effectively overlay mode, switch to explicitly setting -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_SYSTEM configuration option, so that unit tests and release builds are consistent. Verified that all the unit tests pass with this flag specified.


Full diff: https://github.com/llvm/llvm-project/pull/130663.diff

1 Files Affected:

  • (modified) utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl (+5)
diff --git a/utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl b/utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl
index f65da9e98226b..672ce8c0723ec 100644
--- a/utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl
+++ b/utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl
@@ -44,6 +44,11 @@ LIBC_CONFIGURE_OPTIONS = [
     # "LIBC_COPT_STRTOFLOAT_DISABLE_EISEL_LEMIRE",
     # "LIBC_COPT_STRTOFLOAT_DISABLE_SIMPLE_DECIMAL_CONVERSION",
 
+    # Documentation in libc/src/errno/...
+    # Since we're only using Bazel for overlay build for now, explicitly
+    # enforce using the system-provided errno in both tests and release build.
+    "LIBC_ERRNO_MODE=LIBC_ERRNO_MODE_SYSTEM",
+
     # Documentation in libc/src/__support/libc_assert.h
     # "LIBC_COPT_USE_C_ASSERT",
 ]

@vonosmas vonosmas merged commit f9146cc into llvm:main Mar 10, 2025
11 of 13 checks passed
@vonosmas vonosmas deleted the errno-cleanup branch March 10, 2025 20:28
vonosmas added a commit that referenced this pull request Mar 17, 2025
This reverts commit f9146cc
([libc][bazel] explicitly use system-provided errno in Bazel builds.
(#130663))

This change causes problems in Bazel builds where system errno is set to
non-zero before the tests even begin to run - see PR #131650 for the
disucssion on how to address this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bazel "Peripheral" support tier build system: utils/bazel libc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants